class Solution {
public:
    int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
        unordered_map<int,int> mp;
        for (auto a : nums1) {
            for (auto b : nums2) {
                mp[a + b]++;
            }
        }
        int count = 0;
        for (auto c : nums3) {
            for (auto d : nums4) {
                int targe = 0 - (c + d);
                if (mp.find(targe) != mp.end()) {
                    count += mp[targe];
                }
            }
        }
        return count;
    }
};
